from sys import excepthook
from nltk.util import ngrams
import re 

sentence = 'Thomas Jefferson began building Monticello at the age of 26'
pattern = re.compile(r"([-\s.,;!?])+")
tokens = pattern.split(sentence)
tokens = [x for x in tokens if x and x not in '- \t \n,.?!;']
print(tokens)

ngrams2_list = list(ngrams(tokens, 2))
print(ngrams2_list)
ngrams3_list = list(ngrams(tokens, 3))
print(ngrams3_list)

